package com.innerclass.demo3;

/**
 * 将内部类向上转型为其基类，尤其是转型为一个接口的时候，此内部类——某个接口的实现——能够完全不可见，并且不可用，可以很方便的隐藏实现细节
 * 
 * @author Administrator
 * 
 */
public class Parcel4 {

	private class IContents implements Contents {

		private int i = 11;

		@Override
		public int value() {
			return i;
		}

	}

	private class IDestination implements Destination {

		private String label;

		public IDestination(String whereTo) {
			label = whereTo;
		}

		@Override
		public String readLable() {
			System.out.println(label);
			return label;
		}

	}

	public Destination destination(String s) {
		return new IDestination(s);
	}

	public Contents contents() {
		return new IContents();
	}

}
